﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Geometry;
using MyEngineExercise.我的扩展.信息类;

namespace MyEngineExercise.我的扩展.窗体
{
    public partial class InputRedLineInfoForm : Form
    {

        private IPolygon4 _polygon = null;


        /// <summary>
        /// 记录的一条行信息
        /// </summary>
        private RedLineRowInfo _redLineRowInfo = null;
        /// <summary>
        /// 记录的一条行信息
        /// </summary>
        public RedLineRowInfo RedLineRowInfo { get { return _redLineRowInfo; } }


        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="polygon"></param>
        public InputRedLineInfoForm(IPolygon4 polygon)
        {
            InitializeComponent();

            tbxBlockArea.Text = ((IArea)polygon).Area.ToString("F02");

            _polygon = polygon;
        }


        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonOK_Click(object sender, EventArgs e)
        {
            String bloackName = tbxBlockName.Text.Trim();
            String pageNum = tbxPageNum.Text.Trim();
            String landUsage = cboLandUsage.Text.Trim();

            if (String.IsNullOrEmpty(bloackName))
                bloackName = "暂无";

            _redLineRowInfo = new RedLineRowInfo(_polygon, bloackName, pageNum, landUsage);

            this.DialogResult = DialogResult.OK;
            this.Close();
        }


        /// <summary>
        /// 取消
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
